using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace LS
{
    public class TestCameraProjection : MonoBehaviour
    {

        public Vector3[] screenPosition = new Vector3[]
        {
            new Vector3(0.5f, 1, -1),
            new Vector3(0.5f, 0.5f, -1),
            new Vector3(0.5f, 0f, -1),
            new Vector3(0.0f, 0.5f, -1),
            new Vector3(1f, 0.5f, -1),
        };

        public Vector3[] worldPosition = new Vector3[5];
        Camera self;
        // Start is called before the first frame update
        void Start()
        {
            self = GetComponent<Camera>();
        }

        // Update is called once per frame
        void Update()
        {
            for (int i = 0; i < screenPosition.Length; i++)
            {
                worldPosition[i] = self.ViewportToWorldPoint(screenPosition[i]);
            }
        }

#if UNITY_EDITOR
        private void OnDrawGizmos()
        {
            if (UnityEditor.EditorApplication.isPlaying)
            {
                for (int i = 0; i < worldPosition.Length; i++)
                {
                    Gizmos.DrawCube(worldPosition[i], Vector3.one * 0.01f);
                }
            }
        }
#endif
    }
}
